import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  // {
  //   title: '管控措施',
  //   align: "center",
  //   dataIndex: 'riskMeasureId'
  // },
  {
    title: '隐患名称',
    align: "center",
    dataIndex: 'dangerName'
  },
  {
    title: '隐患等级',
    align: "center",
    dataIndex: 'dangerLevel_dictText'
  },
  {
    title: '隐患来源',
    align: "center",
    dataIndex: 'dangerSrc_dictText'
  },
  {
    title: '隐患治理类型',
    align: "center",
    dataIndex: 'dangerManageType_dictText'
  },
  {
    title: '隐患描述',
    align: "center",
    dataIndex: 'dangerDesc'
  },
  {
    title: '隐患产生原因',
    align: "center",
    dataIndex: 'dangerReason'
  },
  {
    title: '控制措施',
    align: "center",
    dataIndex: 'controlMeasures'
  },
  {
    title: '资金',
    align: "center",
    dataIndex: 'cost'
  },
  {
    title: '隐患治理期限',
    align: "center",
    dataIndex: 'dangerManageDeadline'
  },
  {
    title: '隐患状态',
    align: "center",
    dataIndex: 'dangerState_dictText'
  },
  {
    title: '隐患类型',
    align: "center",
    dataIndex: 'hazardDangerType_dictText'
  },
  {
    title: '登记人姓名',
    align: "center",
    dataIndex: 'registrant_dictText'
  },
  {
    title: '登记时间',
    align: "center",
    dataIndex: 'registTime'
  },
  {
    title: '整改责任人姓名',
    align: "center",
    dataIndex: 'liablePerson_dictText'
  },
  {
    title: '图片',
    align: "center",
    dataIndex: 'img',
    customRender: render.renderImage,
  },
  {
    title: '所属装置',
    align: "center",
    dataIndex: 'riskDeviceId_dictText'
  },
  {
    title: '所属单元',
    align: "center",
    dataIndex: 'riskUnitId_dictText'
  },
  {
    title: '隐患类别',
    align: "center",
    dataIndex: 'hazardCategory_dictText'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "管控措施",
    field: 'riskMeasureId',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: " 隐患排查记录",
    field: 'checkRecordId',
    component: 'JDictSelectTag',
    componentProps:{
    },
    //colProps: {span: 6},
  },
  {
    label: "隐患名称",
    field: 'dangerName',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "隐患等级",
    field: 'dangerLevel',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "dangerLevel"
    },
    //colProps: {span: 6},
  },
  {
    label: "隐患来源",
    field: 'dangerSrc',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "dangerSrc"
    },
    //colProps: {span: 6},
  },
  {
    label: "隐患治理类型",
    field: 'dangerManageType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "dangerManageType"
    },
    //colProps: {span: 6},
  },
  {
    label: "隐患描述",
    field: 'dangerDesc',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "隐患状态",
    field: 'dangerState',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "dangerState"
    },
    //colProps: {span: 6},
  },
  {
    label: "隐患类型",
    field: 'hazardDangerType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "hazardDangerType"
    },
    //colProps: {span: 6},
  },
  {
    label: "所属装置",
    field: 'riskDeviceId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "tb_base_risk_device,name,id"
    },
    //colProps: {span: 6},
  },
  {
    label: "所属单元",
    field: 'riskUnitId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "tb_base_risk_unit,risk_unit_name,id"
    },
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '管控措施',
    field: 'riskMeasureId',
    component: 'InputTextArea',
  },
  {
    label: '隐患名称',
    field: 'dangerName',
    component: 'InputTextArea',
  },
  {
    label: '隐患等级',
    field: 'dangerLevel',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "dangerLevel"
    },
  },
  {
    label: '隐患来源',
    field: 'dangerSrc',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "dangerSrc"
    },
  },
  {
    label: '隐患治理类型',
    field: 'dangerManageType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "dangerManageType"
    },
  },
  {
    label: '隐患描述',
    field: 'dangerDesc',
    component: 'InputTextArea',
  },
  {
    label: '隐患产生原因',
    field: 'dangerReason',
    component: 'InputTextArea',
  },
  {
    label: '控制措施',
    field: 'controlMeasures',
    component: 'InputTextArea',
  },
  {
    label: '资金',
    field: 'cost',
    component: 'InputNumber',
  },
  {
    label: '隐患治理期限',
    field: 'dangerManageDeadline',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
  {
    label: '隐患状态',
    field: 'dangerState',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "dangerState"
    },
  },
  {
    label: '隐患类型',
    field: 'hazardDangerType',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "hazardDangerType"
    },
  },
  {
    label: '登记人姓名',
    field: 'registrant',
    component: 'JSelectUserByDept',
    componentProps:{
      labelKey: 'realname',
    },
  },
  {
    label: '登记时间',
    field: 'registTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
      valueFormat: 'YYYY-MM-DD HH:mm:ss'
    },
  },
  {
    label: '整改责任人姓名',
    field: 'liablePerson',
    component: 'JSelectUserByDept',
    componentProps:{
      labelKey: 'realname',
    },
  },
  {
    label: '图片',
    field: 'img',
    component: 'JImageUpload',
    componentProps:{
    },
  },
  {
    label: '所属装置',
    field: 'riskDeviceId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "tb_base_risk_device,name,id"
    },
  },
  {
    label: '所属单元',
    field: 'riskUnitId',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "tb_base_risk_unit,risk_unit_name,id"
    },
  },
  {
    label: '隐患类别',
    field: 'hazardCategory',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "yn"
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  riskMeasureId: {title: '管控措施',order: 0,view: 'textarea', type: 'string',},
  dangerName: {title: '隐患名称',order: 2,view: 'textarea', type: 'string',},
  dangerLevel: {title: '隐患等级',order: 3,view: 'radio', type: 'string',},
  dangerSrc: {title: '隐患来源',order: 4,view: 'list', type: 'string',dictCode: 'dangerSrc',},
  dangerManageType: {title: '隐患治理类型',order: 5,view: 'radio', type: 'string',},
  dangerDesc: {title: '隐患描述',order: 6,view: 'textarea', type: 'string',},
  dangerReason: {title: '隐患产生原因',order: 7,view: 'textarea', type: 'string',},
  controlMeasures: {title: '控制措施',order: 8,view: 'textarea', type: 'string',},
  cost: {title: '资金',order: 9,view: 'number', type: 'number',},
  dangerManageDeadline: {title: '隐患治理期限',order: 10,view: 'datetime', type: 'string',},
  dangerState: {title: '隐患状态',order: 11,view: 'list', type: 'string',dictCode: 'dangerState',},
  hazardDangerType: {title: '隐患类型',order: 12,view: 'list', type: 'string',dictCode: 'hazardDangerType',},
  registrant: {title: '登记人姓名',order: 13,view: 'sel_user', type: 'string',},
  registTime: {title: '登记时间',order: 14,view: 'datetime', type: 'string',},
  liablePerson: {title: '整改责任人姓名',order: 15,view: 'sel_user', type: 'string',},
  img: {title: '图片',order: 16,view: 'image', type: 'string',},
  riskDeviceId: {title: '所属装置',order: 17,view: 'list', type: 'string',dictTable: 'tb_base_risk_device', dictCode: 'id', dictText: 'name',},
  riskUnitId: {title: '所属单元',order: 18,view: 'list', type: 'string',dictTable: 'tb_base_risk_unit', dictCode: 'id', dictText: 'risk_unit_name',},
  hazardCategory: {title: '隐患类别',order: 19,view: 'radio', type: 'string',},
};
